﻿#region Using directives

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using NetROS.Tiers.Entities;
using NetROS.Tiers.Data;

#endregion

namespace NetROS.Tiers.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="VwPreostaloZaZatvaranjeProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract class VwPreostaloZaZatvaranjeProviderBaseCore : EntityViewProviderBase<VwPreostaloZaZatvaranje>
	{
		#region Custom Methods
		
		
		#region _vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno
		
		/// <summary>
		///	This method wrap the '_vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno' stored procedure. 
		/// </summary>
		/// <param name="Konto"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Klijent"> A <c>System.Int32?</c> instance.</param>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="DILIP"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Storno"> A <c>System.Int32?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> instance.</returns>
		public VList<VwPreostaloZaZatvaranje> GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno(System.Int32? @Konto, System.Int32? @Klijent, System.Int32? @IDOrg, System.Int32? @DILIP, System.Int32? @Storno)
		{
			return GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno(null, 0, int.MaxValue , @Konto, @Klijent, @IDOrg, @DILIP, @Storno);
		}
		
		/// <summary>
		///	This method wrap the '_vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno' stored procedure. 
		/// </summary>
		/// <param name="Konto"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Klijent"> A <c>System.Int32?</c> instance.</param>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="DILIP"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Storno"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> instance.</returns>
		public VList<VwPreostaloZaZatvaranje> GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno(int start, int pageLength, System.Int32? @Konto, System.Int32? @Klijent, System.Int32? @IDOrg, System.Int32? @DILIP, System.Int32? @Storno)
		{
			return GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno(null, start, pageLength , @Konto, @Klijent, @IDOrg, @DILIP, @Storno);
		}
				
		/// <summary>
		///	This method wrap the '_vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno' stored procedure. 
		/// </summary>
		/// <param name="Konto"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Klijent"> A <c>System.Int32?</c> instance.</param>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="DILIP"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Storno"> A <c>System.Int32?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <returns>A <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> instance.</returns>
		public VList<VwPreostaloZaZatvaranje> GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno(TransactionManager transactionManager, System.Int32? @Konto, System.Int32? @Klijent, System.Int32? @IDOrg, System.Int32? @DILIP, System.Int32? @Storno)
		{
			return GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno(transactionManager, 0, int.MaxValue , @Konto, @Klijent, @IDOrg, @DILIP, @Storno);
		}
		
		/// <summary>
		///	This method wrap the '_vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno' stored procedure. 
		/// </summary>
		/// <param name="Konto"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Klijent"> A <c>System.Int32?</c> instance.</param>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="DILIP"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Storno"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> instance.</returns>
		public abstract VList<VwPreostaloZaZatvaranje> GetBy_IDKonto_IDMT_IDKlijent_DugiliPot_Storno(TransactionManager transactionManager, int start, int pageLength , System.Int32? @Konto, System.Int32? @Klijent, System.Int32? @IDOrg, System.Int32? @DILIP, System.Int32? @Storno);
		
		#endregion
		
		#region _vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot
		
		/// <summary>
		///	This method wrap the '_vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot' stored procedure. 
		/// </summary>
		/// <param name="Konto"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Klijent"> A <c>System.Int32?</c> instance.</param>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="DILIP"> A <c>System.Int32?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> instance.</returns>
		public VList<VwPreostaloZaZatvaranje> GetBy_IDKonto_IDMT_IDKlijent_DugiliPot(System.Int32? @Konto, System.Int32? @Klijent, System.Int32? @IDOrg, System.Int32? @DILIP)
		{
			return GetBy_IDKonto_IDMT_IDKlijent_DugiliPot(null, 0, int.MaxValue , @Konto, @Klijent, @IDOrg, @DILIP);
		}
		
		/// <summary>
		///	This method wrap the '_vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot' stored procedure. 
		/// </summary>
		/// <param name="Konto"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Klijent"> A <c>System.Int32?</c> instance.</param>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="DILIP"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> instance.</returns>
		public VList<VwPreostaloZaZatvaranje> GetBy_IDKonto_IDMT_IDKlijent_DugiliPot(int start, int pageLength, System.Int32? @Konto, System.Int32? @Klijent, System.Int32? @IDOrg, System.Int32? @DILIP)
		{
			return GetBy_IDKonto_IDMT_IDKlijent_DugiliPot(null, start, pageLength , @Konto, @Klijent, @IDOrg, @DILIP);
		}
				
		/// <summary>
		///	This method wrap the '_vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot' stored procedure. 
		/// </summary>
		/// <param name="Konto"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Klijent"> A <c>System.Int32?</c> instance.</param>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="DILIP"> A <c>System.Int32?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <returns>A <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> instance.</returns>
		public VList<VwPreostaloZaZatvaranje> GetBy_IDKonto_IDMT_IDKlijent_DugiliPot(TransactionManager transactionManager, System.Int32? @Konto, System.Int32? @Klijent, System.Int32? @IDOrg, System.Int32? @DILIP)
		{
			return GetBy_IDKonto_IDMT_IDKlijent_DugiliPot(transactionManager, 0, int.MaxValue , @Konto, @Klijent, @IDOrg, @DILIP);
		}
		
		/// <summary>
		///	This method wrap the '_vwPreostaloZaZatvaranje_GetBy_IDKonto_IDMT_IDKlijent_DugiliPot' stored procedure. 
		/// </summary>
		/// <param name="Konto"> A <c>System.Int32?</c> instance.</param>
		/// <param name="Klijent"> A <c>System.Int32?</c> instance.</param>
		/// <param name="IDOrg"> A <c>System.Int32?</c> instance.</param>
		/// <param name="DILIP"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> instance.</returns>
		public abstract VList<VwPreostaloZaZatvaranje> GetBy_IDKonto_IDMT_IDKlijent_DugiliPot(TransactionManager transactionManager, int start, int pageLength , System.Int32? @Konto, System.Int32? @Klijent, System.Int32? @IDOrg, System.Int32? @DILIP);
		
		#endregion
		
		#endregion

		#region Helper Functions
		
		/*
		///<summary>
		/// Fill an VList&lt;VwPreostaloZaZatvaranje&gt; From a DataSet
		///</summary>
		/// <param name="dataSet">the DataSet</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList&lt;VwPreostaloZaZatvaranje&gt;"/></returns>
		protected static VList&lt;VwPreostaloZaZatvaranje&gt; Fill(DataSet dataSet, VList<VwPreostaloZaZatvaranje> rows, int start, int pagelen)
		{
			if (dataSet.Tables.Count == 1)
			{
				return Fill(dataSet.Tables[0], rows, start, pagelen);
			}
			else
			{
				return new VList<VwPreostaloZaZatvaranje>();
			}	
		}
		
		
		///<summary>
		/// Fill an VList&lt;VwPreostaloZaZatvaranje&gt; From a DataTable
		///</summary>
		/// <param name="dataTable">the DataTable that hold the data.</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList<VwPreostaloZaZatvaranje>"/></returns>
		protected static VList&lt;VwPreostaloZaZatvaranje&gt; Fill(DataTable dataTable, VList<VwPreostaloZaZatvaranje> rows, int start, int pagelen)
		{
			int recordnum = 0;
			
			System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
			
			while (dataRows.MoveNext() && (pagelen != 0))
			{
				if(recordnum >= start)
				{
					DataRow row = (DataRow)dataRows.Current;
				
					VwPreostaloZaZatvaranje c = new VwPreostaloZaZatvaranje();
					c.IDKnjizenjeStavka = (Convert.IsDBNull(row["IDKnjizenjeStavka"]))?(int)0:(System.Int32)row["IDKnjizenjeStavka"];
					c.IDOrg = (Convert.IsDBNull(row["IDOrg"]))?(int)0:(System.Int32)row["IDOrg"];
					c.SifraSkladista = (Convert.IsDBNull(row["SifraSkladista"]))?string.Empty:(System.String)row["SifraSkladista"];
					c.DatumDospijeca = (Convert.IsDBNull(row["DatumDospijeca"]))?DateTime.MinValue:(System.DateTime?)row["DatumDospijeca"];
					c.DatumDokumentaOriginal = (Convert.IsDBNull(row["DatumDokumentaOriginal"]))?DateTime.MinValue:(System.DateTime)row["DatumDokumentaOriginal"];
					c.SifraOriginalnogDokumenta = (Convert.IsDBNull(row["SifraOriginalnogDokumenta"]))?string.Empty:(System.String)row["SifraOriginalnogDokumenta"];
					c.Nalog = (Convert.IsDBNull(row["Nalog"]))?string.Empty:(System.String)row["Nalog"];
					c.Poziv = (Convert.IsDBNull(row["Poziv"]))?string.Empty:(System.String)row["Poziv"];
					c.KontoSifra = (Convert.IsDBNull(row["KontoSifra"]))?string.Empty:(System.String)row["KontoSifra"];
					c.KontoNaziv = (Convert.IsDBNull(row["KontoNaziv"]))?string.Empty:(System.String)row["KontoNaziv"];
					c.VrstaFinDokNaziv = (Convert.IsDBNull(row["VrstaFinDokNaziv"]))?string.Empty:(System.String)row["VrstaFinDokNaziv"];
					c.VrstaDokSifra = (Convert.IsDBNull(row["VrstaDokSifra"]))?string.Empty:(System.String)row["VrstaDokSifra"];
					c.ImeKlijenta = (Convert.IsDBNull(row["ImeKlijenta"]))?string.Empty:(System.String)row["ImeKlijenta"];
					c.MB = (Convert.IsDBNull(row["MB"]))?string.Empty:(System.String)row["MB"];
					c.Dug = (Convert.IsDBNull(row["Dug"]))?0:(System.Decimal)row["Dug"];
					c.Pot = (Convert.IsDBNull(row["Pot"]))?0:(System.Decimal)row["Pot"];
					c.Preostalo = (Convert.IsDBNull(row["Preostalo"]))?0:(System.Decimal?)row["Preostalo"];
					c.IDStatus = (Convert.IsDBNull(row["IDStatus"]))?(int)0:(System.Int32)row["IDStatus"];
					c.AcceptChanges();
					rows.Add(c);
					pagelen -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		*/	
						
		///<summary>
		/// Fill an <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/> From a DataReader.
		///</summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pageLength">number of row.</param>
		///<returns>a <see cref="VList&lt;VwPreostaloZaZatvaranje&gt;"/></returns>
		protected VList<VwPreostaloZaZatvaranje> Fill(IDataReader reader, VList<VwPreostaloZaZatvaranje> rows, int start, int pageLength)
		{
			int recordnum = 0;
			while (reader.Read() && (pageLength != 0))
			{
				if(recordnum >= start)
				{
					VwPreostaloZaZatvaranje entity = null;
					if (DataRepository.Provider.UseEntityFactory)
					{
						entity = EntityManager.CreateViewEntity<VwPreostaloZaZatvaranje>("VwPreostaloZaZatvaranje",  DataRepository.Provider.EntityCreationalFactoryType); 
					}
					else
					{
						entity = new VwPreostaloZaZatvaranje();
					}
					entity.IDKnjizenjeStavka = (System.Int32)reader["IDKnjizenjeStavka"];
					//entity.IDKnjizenjeStavka = (Convert.IsDBNull(reader["IDKnjizenjeStavka"]))?(int)0:(System.Int32)reader["IDKnjizenjeStavka"];
					entity.IDOrg = (System.Int32)reader["IDOrg"];
					//entity.IDOrg = (Convert.IsDBNull(reader["IDOrg"]))?(int)0:(System.Int32)reader["IDOrg"];
					entity.SifraSkladista = (System.String)reader["SifraSkladista"];
					//entity.SifraSkladista = (Convert.IsDBNull(reader["SifraSkladista"]))?string.Empty:(System.String)reader["SifraSkladista"];
					entity.DatumDospijeca = reader.IsDBNull(reader.GetOrdinal("DatumDospijeca")) ? null : (System.DateTime?)reader["DatumDospijeca"];
					//entity.DatumDospijeca = (Convert.IsDBNull(reader["DatumDospijeca"]))?DateTime.MinValue:(System.DateTime?)reader["DatumDospijeca"];
					entity.DatumDokumentaOriginal = (System.DateTime)reader["DatumDokumentaOriginal"];
					//entity.DatumDokumentaOriginal = (Convert.IsDBNull(reader["DatumDokumentaOriginal"]))?DateTime.MinValue:(System.DateTime)reader["DatumDokumentaOriginal"];
					entity.SifraOriginalnogDokumenta = reader.IsDBNull(reader.GetOrdinal("SifraOriginalnogDokumenta")) ? null : (System.String)reader["SifraOriginalnogDokumenta"];
					//entity.SifraOriginalnogDokumenta = (Convert.IsDBNull(reader["SifraOriginalnogDokumenta"]))?string.Empty:(System.String)reader["SifraOriginalnogDokumenta"];
					entity.Nalog = (System.String)reader["Nalog"];
					//entity.Nalog = (Convert.IsDBNull(reader["Nalog"]))?string.Empty:(System.String)reader["Nalog"];
					entity.Poziv = reader.IsDBNull(reader.GetOrdinal("Poziv")) ? null : (System.String)reader["Poziv"];
					//entity.Poziv = (Convert.IsDBNull(reader["Poziv"]))?string.Empty:(System.String)reader["Poziv"];
					entity.KontoSifra = (System.String)reader["KontoSifra"];
					//entity.KontoSifra = (Convert.IsDBNull(reader["KontoSifra"]))?string.Empty:(System.String)reader["KontoSifra"];
					entity.KontoNaziv = (System.String)reader["KontoNaziv"];
					//entity.KontoNaziv = (Convert.IsDBNull(reader["KontoNaziv"]))?string.Empty:(System.String)reader["KontoNaziv"];
					entity.VrstaFinDokNaziv = (System.String)reader["VrstaFinDokNaziv"];
					//entity.VrstaFinDokNaziv = (Convert.IsDBNull(reader["VrstaFinDokNaziv"]))?string.Empty:(System.String)reader["VrstaFinDokNaziv"];
					entity.VrstaDokSifra = (System.String)reader["VrstaDokSifra"];
					//entity.VrstaDokSifra = (Convert.IsDBNull(reader["VrstaDokSifra"]))?string.Empty:(System.String)reader["VrstaDokSifra"];
					entity.ImeKlijenta = (System.String)reader["ImeKlijenta"];
					//entity.ImeKlijenta = (Convert.IsDBNull(reader["ImeKlijenta"]))?string.Empty:(System.String)reader["ImeKlijenta"];
					entity.MB = reader.IsDBNull(reader.GetOrdinal("MB")) ? null : (System.String)reader["MB"];
					//entity.MB = (Convert.IsDBNull(reader["MB"]))?string.Empty:(System.String)reader["MB"];
					entity.Dug = (System.Decimal)reader["Dug"];
					//entity.Dug = (Convert.IsDBNull(reader["Dug"]))?0:(System.Decimal)reader["Dug"];
					entity.Pot = (System.Decimal)reader["Pot"];
					//entity.Pot = (Convert.IsDBNull(reader["Pot"]))?0:(System.Decimal)reader["Pot"];
					entity.Preostalo = reader.IsDBNull(reader.GetOrdinal("Preostalo")) ? null : (System.Decimal?)reader["Preostalo"];
					//entity.Preostalo = (Convert.IsDBNull(reader["Preostalo"]))?0:(System.Decimal?)reader["Preostalo"];
					entity.IDStatus = (System.Int32)reader["IDStatus"];
					//entity.IDStatus = (Convert.IsDBNull(reader["IDStatus"]))?(int)0:(System.Int32)reader["IDStatus"];
					entity.AcceptChanges();
					rows.Add(entity);
					pageLength -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		
		
		/// <summary>
		/// Refreshes the <see cref="VwPreostaloZaZatvaranje"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="VwPreostaloZaZatvaranje"/> object to refresh.</param>
		protected void RefreshEntity(IDataReader reader, VwPreostaloZaZatvaranje entity)
		{
			reader.Read();
			entity.IDKnjizenjeStavka = (System.Int32)reader["IDKnjizenjeStavka"];
			//entity.IDKnjizenjeStavka = (Convert.IsDBNull(reader["IDKnjizenjeStavka"]))?(int)0:(System.Int32)reader["IDKnjizenjeStavka"];
			entity.IDOrg = (System.Int32)reader["IDOrg"];
			//entity.IDOrg = (Convert.IsDBNull(reader["IDOrg"]))?(int)0:(System.Int32)reader["IDOrg"];
			entity.SifraSkladista = (System.String)reader["SifraSkladista"];
			//entity.SifraSkladista = (Convert.IsDBNull(reader["SifraSkladista"]))?string.Empty:(System.String)reader["SifraSkladista"];
			entity.DatumDospijeca = reader.IsDBNull(reader.GetOrdinal("DatumDospijeca")) ? null : (System.DateTime?)reader["DatumDospijeca"];
			//entity.DatumDospijeca = (Convert.IsDBNull(reader["DatumDospijeca"]))?DateTime.MinValue:(System.DateTime?)reader["DatumDospijeca"];
			entity.DatumDokumentaOriginal = (System.DateTime)reader["DatumDokumentaOriginal"];
			//entity.DatumDokumentaOriginal = (Convert.IsDBNull(reader["DatumDokumentaOriginal"]))?DateTime.MinValue:(System.DateTime)reader["DatumDokumentaOriginal"];
			entity.SifraOriginalnogDokumenta = reader.IsDBNull(reader.GetOrdinal("SifraOriginalnogDokumenta")) ? null : (System.String)reader["SifraOriginalnogDokumenta"];
			//entity.SifraOriginalnogDokumenta = (Convert.IsDBNull(reader["SifraOriginalnogDokumenta"]))?string.Empty:(System.String)reader["SifraOriginalnogDokumenta"];
			entity.Nalog = (System.String)reader["Nalog"];
			//entity.Nalog = (Convert.IsDBNull(reader["Nalog"]))?string.Empty:(System.String)reader["Nalog"];
			entity.Poziv = reader.IsDBNull(reader.GetOrdinal("Poziv")) ? null : (System.String)reader["Poziv"];
			//entity.Poziv = (Convert.IsDBNull(reader["Poziv"]))?string.Empty:(System.String)reader["Poziv"];
			entity.KontoSifra = (System.String)reader["KontoSifra"];
			//entity.KontoSifra = (Convert.IsDBNull(reader["KontoSifra"]))?string.Empty:(System.String)reader["KontoSifra"];
			entity.KontoNaziv = (System.String)reader["KontoNaziv"];
			//entity.KontoNaziv = (Convert.IsDBNull(reader["KontoNaziv"]))?string.Empty:(System.String)reader["KontoNaziv"];
			entity.VrstaFinDokNaziv = (System.String)reader["VrstaFinDokNaziv"];
			//entity.VrstaFinDokNaziv = (Convert.IsDBNull(reader["VrstaFinDokNaziv"]))?string.Empty:(System.String)reader["VrstaFinDokNaziv"];
			entity.VrstaDokSifra = (System.String)reader["VrstaDokSifra"];
			//entity.VrstaDokSifra = (Convert.IsDBNull(reader["VrstaDokSifra"]))?string.Empty:(System.String)reader["VrstaDokSifra"];
			entity.ImeKlijenta = (System.String)reader["ImeKlijenta"];
			//entity.ImeKlijenta = (Convert.IsDBNull(reader["ImeKlijenta"]))?string.Empty:(System.String)reader["ImeKlijenta"];
			entity.MB = reader.IsDBNull(reader.GetOrdinal("MB")) ? null : (System.String)reader["MB"];
			//entity.MB = (Convert.IsDBNull(reader["MB"]))?string.Empty:(System.String)reader["MB"];
			entity.Dug = (System.Decimal)reader["Dug"];
			//entity.Dug = (Convert.IsDBNull(reader["Dug"]))?0:(System.Decimal)reader["Dug"];
			entity.Pot = (System.Decimal)reader["Pot"];
			//entity.Pot = (Convert.IsDBNull(reader["Pot"]))?0:(System.Decimal)reader["Pot"];
			entity.Preostalo = reader.IsDBNull(reader.GetOrdinal("Preostalo")) ? null : (System.Decimal?)reader["Preostalo"];
			//entity.Preostalo = (Convert.IsDBNull(reader["Preostalo"]))?0:(System.Decimal?)reader["Preostalo"];
			entity.IDStatus = (System.Int32)reader["IDStatus"];
			//entity.IDStatus = (Convert.IsDBNull(reader["IDStatus"]))?(int)0:(System.Int32)reader["IDStatus"];
			reader.Close();
	
			entity.AcceptChanges();
		}
		
		/*
		/// <summary>
		/// Refreshes the <see cref="VwPreostaloZaZatvaranje"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="VwPreostaloZaZatvaranje"/> object.</param>
		protected static void RefreshEntity(DataSet dataSet, VwPreostaloZaZatvaranje entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.IDKnjizenjeStavka = (Convert.IsDBNull(dataRow["IDKnjizenjeStavka"]))?(int)0:(System.Int32)dataRow["IDKnjizenjeStavka"];
			entity.IDOrg = (Convert.IsDBNull(dataRow["IDOrg"]))?(int)0:(System.Int32)dataRow["IDOrg"];
			entity.SifraSkladista = (Convert.IsDBNull(dataRow["SifraSkladista"]))?string.Empty:(System.String)dataRow["SifraSkladista"];
			entity.DatumDospijeca = (Convert.IsDBNull(dataRow["DatumDospijeca"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumDospijeca"];
			entity.DatumDokumentaOriginal = (Convert.IsDBNull(dataRow["DatumDokumentaOriginal"]))?DateTime.MinValue:(System.DateTime)dataRow["DatumDokumentaOriginal"];
			entity.SifraOriginalnogDokumenta = (Convert.IsDBNull(dataRow["SifraOriginalnogDokumenta"]))?string.Empty:(System.String)dataRow["SifraOriginalnogDokumenta"];
			entity.Nalog = (Convert.IsDBNull(dataRow["Nalog"]))?string.Empty:(System.String)dataRow["Nalog"];
			entity.Poziv = (Convert.IsDBNull(dataRow["Poziv"]))?string.Empty:(System.String)dataRow["Poziv"];
			entity.KontoSifra = (Convert.IsDBNull(dataRow["KontoSifra"]))?string.Empty:(System.String)dataRow["KontoSifra"];
			entity.KontoNaziv = (Convert.IsDBNull(dataRow["KontoNaziv"]))?string.Empty:(System.String)dataRow["KontoNaziv"];
			entity.VrstaFinDokNaziv = (Convert.IsDBNull(dataRow["VrstaFinDokNaziv"]))?string.Empty:(System.String)dataRow["VrstaFinDokNaziv"];
			entity.VrstaDokSifra = (Convert.IsDBNull(dataRow["VrstaDokSifra"]))?string.Empty:(System.String)dataRow["VrstaDokSifra"];
			entity.ImeKlijenta = (Convert.IsDBNull(dataRow["ImeKlijenta"]))?string.Empty:(System.String)dataRow["ImeKlijenta"];
			entity.MB = (Convert.IsDBNull(dataRow["MB"]))?string.Empty:(System.String)dataRow["MB"];
			entity.Dug = (Convert.IsDBNull(dataRow["Dug"]))?0:(System.Decimal)dataRow["Dug"];
			entity.Pot = (Convert.IsDBNull(dataRow["Pot"]))?0:(System.Decimal)dataRow["Pot"];
			entity.Preostalo = (Convert.IsDBNull(dataRow["Preostalo"]))?0:(System.Decimal?)dataRow["Preostalo"];
			entity.IDStatus = (Convert.IsDBNull(dataRow["IDStatus"]))?(int)0:(System.Int32)dataRow["IDStatus"];
			entity.AcceptChanges();
		}
		*/
			
		#endregion Helper Functions
	}//end class

	#region VwPreostaloZaZatvaranjeFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwPreostaloZaZatvaranje"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwPreostaloZaZatvaranjeFilterBuilder : SqlFilterBuilder<VwPreostaloZaZatvaranjeColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwPreostaloZaZatvaranjeFilterBuilder class.
		/// </summary>
		public VwPreostaloZaZatvaranjeFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwPreostaloZaZatvaranjeFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwPreostaloZaZatvaranjeFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwPreostaloZaZatvaranjeFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwPreostaloZaZatvaranjeFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwPreostaloZaZatvaranjeFilterBuilder

	#region VwPreostaloZaZatvaranjeParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwPreostaloZaZatvaranje"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwPreostaloZaZatvaranjeParameterBuilder : ParameterizedSqlFilterBuilder<VwPreostaloZaZatvaranjeColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwPreostaloZaZatvaranjeParameterBuilder class.
		/// </summary>
		public VwPreostaloZaZatvaranjeParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwPreostaloZaZatvaranjeParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwPreostaloZaZatvaranjeParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwPreostaloZaZatvaranjeParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwPreostaloZaZatvaranjeParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwPreostaloZaZatvaranjeParameterBuilder
} // end namespace
